<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/inc/common.jsp"%>
<html>
<head>
<title>后台管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
	$(function() {
		var department = '${user.department}';
		if(department !== null && department !== ""){
			//$('#department').attr("readonly");
			$("#department").combobox('disable'); 
		}else{
			//$('#department').removeAttr("readonly");
			$("#department").combobox('enable'); 
		}
	});
	function saveDate(){
		var state = $("#state").combobox('getValue');
		var actionUrl = "${basePath}/sys/user/save.do";
		$('#ff').form('submit', {
		     url:actionUrl,
		     onSubmit: function(){
		 		if(state == ""){
		 			$.messager.alert('消息', "请选择状态!");
		 			return false;
		 		}
		    	return $(this).form('validate');
		     },
		     success:function(msg){
	    		 if(msg == "success"){
		    		 window.location.href="${basePath}/sys/user/index.do";
		    	 }else if(msg == "repeat"){
		           	 $.messager.alert('消息', "该登录名已存在,请修改后保存!");
		         }else{
		        	 //window.location.href=msg;
		        	 document.write(msg);//异常捕获跳转
		         }	  
		    } 
		  
		 });
	}
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'center',title:'',footer:'#searchfooter'" >
		<div class="easyui-panel" data-options="fit:true,collapsible:true,title:'用户信息'"  style="padding:10px 10px 10px 10px;">
	    <form id="ff"  method="post">
	    	<input type="hidden" id="id" name="id" value="${user.id}" />
	    	<table  style="width:100%;" cellpadding="0" cellspacing="1"  class="formtablecol1">
	    		<tr>
	    			<td align="right" style="width: 20%">登录名:</td>
	    			<td class="value">
		    			<input class="easyui-textbox" type="text" name="accountName" value="${user.accountName}" data-options="required:true"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td align="right" >昵称:</td>
	    			<td class="value">
	    				<input class="easyui-textbox" type="text" name="userName" value="${user.userName}"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td align="right">所属部门:</td>
	    			<td class="value">
	    			<input class="easyui-combobox" id="department" name="department" value="${user.department}" data-options="url:'<%=path%>/business/department/dicbykey.do?&type=1',method:'get',valueField:'id',textField:'name',panelHeight:'auto',editable:false">
	    			</td>
	    		</tr>
	    		<tr>
	    			<td align="right">状态:</td>
	    			<td class="value">
	    			<input class="easyui-combobox" id="state" name="state" value="${user.state}" data-options="url:'<%=path%>/sys/dictionary/dicbykey.do?key=1002',method:'get',valueField:'dataCode',textField:'dataName',panelHeight:'auto',editable:false,required:true">
	    			</td>
	    		</tr>
	    	</table>
	    </form>
	   
	    </div>
		</div>
	<!-- 保存按钮 -->
	<div id="searchfooter" style="text-align:right;padding: 0px 10px">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="saveDate()"  data-options="iconCls:'icon-page_save',plain:true" >保存</a>
		<span class="search-btn-separator"></span>
		<a href="javascript:history.go(-1)" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true">返回</a>
	</div>
</body>
</html>
